#include "Modify_Result.h"


Modify_Result::Modify_Result(char *ras,bool s,char *dn,vector<Atribut<char*>> atrib_mod,vector<Atribut<char*>> atrib_negasite):LDAP_Result(ras,s),
	atribute_modificate(atrib_mod),atribute_negasite(atrib_negasite)
{
	DN_Modificata=new char[strlen(dn)+1];
	if(DN_Modificata==0)
		throw new exception();
	strcpy(DN_Modificata,dn);
}

Modify_Result::~Modify_Result(void)
{
	delete[] DN_Modificata;
}

void Modify_Result::afisareResult()const
{
	if(Succes==false)
	{
		delete[] DN_Modificata;
		throw new Modify_Result_Exception("",3);
	}
	cout<<"Intrarea in care s-au facut modificari este:";
	cout<<DN_Modificata<<endl;
	cout<<"Atributele modificate sunt:\n";
	for(int i=0;i<atribute_modificate.size();i++)
		cout<<atribute_modificate[i].daAtribut()<<endl;
	cout<<"\n\nAtributele negasite sunt:\n";
	for(int i=0;i<atribute_negasite.size();i++)
		cout<<atribute_negasite[i].daAtribut()<<endl;
}

vector<Atribut<char*>> Modify_Result::Da_atribute_modificate()const
{
	return atribute_modificate;
}

vector<Atribut<char*>> Modify_Result::Da_atribute_negasite()const
{
	return atribute_negasite;
}
